const co = require("co")
const fetch = require("node-fetch")
const util = require("util")
const fs = require("fs")
const {resolve} = require("path")

co(function *() {
    const res = yield fetch("https://api.douban.com/v2/movie/1291843")
    const movie = yield res.json()
    console.log(movie);
})


const readFile = util.promisify(fs.readFile)
async function init () {
    let res = await readFile(resolve(__dirname,"../package.json"))
    res = JSON.parse(res)
    console.log(res)
}
init()